package cachex

import "strings"

func (s *Object) RefReplaceObjectByPath(path string, val map[string]interface{}) {
	if string(path[0]) != "/" {
		panic("路径的首字符必须为/")
	}
	path = path[1:]
	pathArr := strings.Split(path, "/")
	obj := s.getObjectByPath(pathArr)
	if obj != nil {
		obj.RefNew()
		obj.RefUpdate(val)
	}
}
